home *** CD-ROM | disk | FTP | other *** search
/ Revista do CD-ROM 101 / CD-ROM 101.iso / compl / maya5ple / Install_MayaPLE5_English.exe / Maya / Data1.cab / buildHypergraphFilePopupMenu < prev    next >
Encoding:
Text File  |  2003-07-17  |  4.8 KB  |  161 lines

  1. // Copyright (C) 1997-2002 Alias|Wavefront,
  2. // a division of Silicon Graphics Limited.
  3. //
  4. // The information in this file is provided for the exclusive use of the
  5. // licensees of Alias|Wavefront.  Such users have the right to use, modify,
  6. // and incorporate this code into other products for purposes authorized
  7. // by the Alias|Wavefront license agreement, without fee.
  8. //
  9. // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  10. // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
  11. // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  12. // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  13. // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  14. // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  15. // PERFORMANCE OF THIS SOFTWARE.
  16. //
  17. // Copyright (C) 2000 Alias|Wavefront,
  18. // a division of Silicon Graphics Limited.
  19. //
  20. // The information in this file is provided for the exclusive use of the
  21. // licensees of Alias|Wavefront.  Such users have the right to use, modify,
  22. // and incorporate this code into other products for purposes authorized
  23. // by the Alias|Wavefront license agreement, without fee.
  24. //
  25. // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  26. // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
  27. // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  28. // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  29. // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  30. // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  31. // PERFORMANCE OF THIS SOFTWARE.
  32. //
  33. //
  34. //  Alias|Wavefront Script File
  35. //  MODIFY THIS AT YOUR OWN RISK
  36. //
  37. //  Creation Date:  December 11/2000
  38. //  Author:         jdc rendering
  39. //
  40. // Description:
  41. //
  42. //        This file contains the procedure which builds a popup menu for a file
  43. //        the user has RMB clicked on in a hypergraph/visor.
  44. //                                                
  45.  
  46. global proc buildHypergraphFilePopupMenuItems(
  47.     string $editor,
  48.     string $menu,
  49.     string $filePath)
  50. {
  51.     setParent -menu $menu;
  52.  
  53.     string $fileNameArray[];
  54.     tokenize($filePath, "/", $fileNameArray);
  55.     string $fileNameTail = $fileNameArray[size($fileNameArray) - 1];
  56.  
  57.     string $fileTypesArray[] = `file -query -type $filePath`;
  58.     string $fileType = $fileTypesArray[0];
  59.  
  60.     if ($fileType == "mayaBinary" || $fileType == "mayaAscii" || $fileType == "mayaPLE")
  61.     {
  62.         // The file under the cursor is a maya binary or ascii file.
  63.         //
  64.         menuItem 
  65.             -label ("Import Maya File " + $fileNameTail)
  66.             -command ("file -import \"" + $filePath + "\"");
  67.     }
  68.     else if ($fileType == "image")
  69.     {
  70.         int $withPlacement;
  71.  
  72.         $withPlacement = 
  73.             (`optionVar -query createTexturesWithPlacement`);
  74.  
  75.         menuItem 
  76.             -label ("Import " + $fileNameTail )
  77.             -annotation 
  78.                 ("As Normal: Import " 
  79.                     + $fileNameTail 
  80.                     + " as a normal file texture")
  81.             -command
  82.                 ("importImageFile \"" 
  83.                     + $filePath 
  84.                     + "\" "
  85.                     + "false " // asProjection
  86.                     + "false " // asStencil
  87.                     + $withPlacement
  88.                     );
  89.         menuItem 
  90.             -label ("Import " + $fileNameTail + " as Projection")
  91.             -annotation 
  92.                 ("As Projection: Import " 
  93.                     + $fileNameTail 
  94.                     + " as a projected file texture")
  95.             -command
  96.                 ("importImageFile \"" 
  97.                     + $filePath 
  98.                     + "\" "
  99.                     + "true " // asProjection
  100.                     + "false " // asStencil
  101.                     + $withPlacement
  102.                     );
  103.         menuItem 
  104.             -label ("Import " + $fileNameTail + " as Stencil")
  105.             -annotation 
  106.                 ("As Stencil: Import " 
  107.                     + $fileNameTail 
  108.                     + " as a stencilled file texture")
  109.             -command
  110.                 ("importImageFile \"" 
  111.                     + $filePath 
  112.                     + "\" "
  113.                     + "false " // asProjection
  114.                     + "true " // asStencil
  115.                     + $withPlacement
  116.                     );
  117.         menuItem -divider true;
  118.         menuItem
  119.             -label "Include Placement"
  120.             -checkBox $withPlacement
  121.             -annotation
  122.                 ("Include Placement: If on, new textures are created "
  123.                     + "with an associated placement node")
  124.             -command
  125.                 ("optionVar -intValue createTexturesWithPlacement "
  126.                     + (!$withPlacement)
  127.                     + "; refreshCreateNodeUI();");
  128.         menuItem -divider true;
  129.         menuItem
  130.             -label "Refresh Swatch"
  131.             -annotation
  132.                 ("Refresh Swatch: Update this swatch to reflect any changes "
  133.                     + "which have been made to the file")
  134.             -command
  135.                 ("visor -refreshSwatch \"" 
  136.                     + $filePath 
  137.                     + "\" "
  138.                     + $editor);
  139.     }
  140.     else if ($fileType == "mel")
  141.     {
  142.         // The file under the cursor is a mel file.
  143.         //
  144.         menuItem 
  145.             -label ("Source " + $fileNameTail)
  146.             -command 
  147.                 ("source \"" 
  148.                     + $filePath 
  149.                     + "\"");
  150.     }
  151.     else
  152.     {
  153.         // There is no file under the cursor, or there is a file under the
  154.         // cursor but we do not recognize its type.
  155.         //
  156.         menuItem
  157.             -label ("No options available")
  158.             -enable false;
  159.     }
  160. }
  161.